<?php
// 本类由系统自动生成，仅供测试用途
class IndexAction extends Action {
	/*
    public function index(){
	$this->show('<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微软雅黑"; color: #333;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px }</style><div style="padding: 24px 48px;"> <h1>:)</h1><p>欢迎使用 <b>ThinkPHP</b>！</p></div><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script>','utf-8');
    }
	*/

	public function index(){
		$data = array(
			array(
				'id' => 1,
				'val' => 'aaa'
			),
			array(
				'id' => 2,
				'val' => 'bbb'
			),
			array(
				'id' => 3,
				'val' => 'ccc'
			)
		);
		
		$curr = I('curr', 0);
		if($curr != 0){
			$this->assign('curr', $curr);
		}
		$this->assign('data', $data);

		$this->display();
	}

	public function phpinfo(){
		phpinfo();
	}

	public function echarts(){
		$this->display();
	}

	public function cache(){
		//S('mike', array('uname'=>'mike', 'upass'=>'123456'), 86400);
		//S('mike', array('uname'=>'mike', 'upass'=>'123456123123'), 86400);
		S('mike', array('uuu'=>'mikeuuu'), 86400);
	}

	public function md55(){
		header("content-type:text/html;charset=UTF-8");
		echo '69588311 字符串的md5 ====  ' . md5('69588311');
		echo "<hr/>";
		echo '69588311 整型的md5 ====  ' . md5(69588311);
	}
	
	public function mysqlAdd(){
		$data = array(
			'uname' => 'test111',
			'age' => 111
		);
		$res = M('user')->add($data);
		$this->pr($res);
	}

	public function mysqlsave(){
		$where = array(
			'uname' => 'good'
			);
		$data = array(
			'age' => 99
			);
		$res = M('user')->where($where)->save($data);
		var_dump($res);
	}

	public function mysqlsave2(){		
		$data = array(
			'id' => 2,
			'age' => 99
			);
		$res = M('user')->save($data);
		var_dump($res);
	}

	public function mysqlsave3(){		
		$data = array(
			'id' => 1,
			'age' => 99
			);
		$res = M('user')->data($data)->save();
		var_dump($res);
	}

	public function mysqlsave4(){
		$where = array(
			'uname' => 'good'
			);
		$data = array(
			'age' => 46
			);
		$res = M('user')->where($where)->data($data)->save();
		var_dump($res);
	}


	public function uu1(){
		import('ORG.Net.UserCenter');
		UserCenter::met1(array('uname'=>'qwer', 'uage'=>123));
	}

	public function uu2(){
		import('ORG.Net.UserCenter');
		UserCenter::met1(array('uname'=>'asdf', 'uage'=>456));
	}

	public function uu3(){
		import('ORG.Net.UserCenter');
		UserCenter::met1(array('uname'=>'qwer', 'uage'=>123));
		UserCenter::met1(array('uname'=>'asdf', 'uage'=>456));
	}

	public function uu4(){
		import('ORG.Net.UserCenter');
		UserCenter::met3(array('uname'=>'asdf', 'uage'=>456));
	}


	public function cacheSet(){
		S('abcd', array(
			'uname' => 'test111',
			'age' => 111
		));
	}

	public function cacheGet(){
		dump(S('abcd'));
	}

	public function jsonTest(){
		echo json_encode(array(
			'list' => array(
				array('name'=>'hehe','age'=>111),
				array('name'=>'meme','age'=>222),
			)
		));
	}
}